%-------------------------------------------------------------------------
%
% Latex-Beamer theme for non-commercial/private use
%
%
% Author: Xian Qiu
% Date: May 1, 2015
% Version: 1.1beta
%
% ------------------------------------------------------------------------

%-------------------------------------------------------------------------
% Title page: default beamer size  
%                      \paperwidth x \paperheight = 12.8cm x 9.6cm 
%             left/right margin: 1cm
%             \textwidth = 10.8 cm 
%-------------------------------------------------------------------------



%------------------------------------------------------------
% title style
%------------------------------------------------------------
\tikzset{
	tts@title/.style={
		rectangle,
		titlefg,
		fill = titlebg,
		inner ysep = 10pt,
		minimum width = \paperwidth,
		text width = \textwidth,
		align = center,
		anchor = south
	}
}

%------------------------------------------------------------
% subtitle style
%------------------------------------------------------------
\tikzset{
	tts@subtitle/.style={
		rectangle,
		subtitlefg,  
		fill = titlebg,
		text height = 5pt,
		text depth = 3pt,
		node distance = -10pt,
		minimum width = \paperwidth,
		text width = \textwidth,
		align = center
	}
}

%------------------------------------------------------------
% author style
%------------------------------------------------------------
\tikzset{
	tts@author/.style={
		authorfg,
		text width = \textwidth,
		align = center
	}
}

%------------------------------------------------------------
% institute style
%------------------------------------------------------------
\tikzset{
	tts@institute/.style={
		institutefg,
		text width = \textwidth,
		align = center,
		anchor = north,
		execute at begin node=\linespread{1.2}
	}
}

%------------------------------------------------------------
% email style
%------------------------------------------------------------
\tikzset{
	tts@email/.style={
		rounded rectangle,
		emailfg,
		align = center,
		fill = emailbg,
		inner sep = 1pt
	}
}

%------------------------------------------------------------
% date style
%------------------------------------------------------------
\tikzset{
	tts@date/.style={
		datefg,
		align = center
	}
}


\defbeamertemplate*{title page}{tts}{
	\begin{tikzpicture}[overlay,shift={(0,-0.3)}]
	%--------
	% title %
	%--------
	\node[tts@title] (title) at (\textwidth/2,0.25) {\usebeamerfont{frametitle}\inserttitle};
	
	%-----------
	% subtitle %
	%-----------
	% \ifdefined\insert@subtitle
	% \node[tts@subtitle] (subtitle) [below = of title] {\usebeamerfont{subtitle}\insert@subtitle};
	% \else
	% \fi
	
	%------------------
	% author(speaker) %
	%------------------
	\node[tts@author] (author) at (\textwidth/2,-1) {\usebeamerfont{author}\textbf{\insertauthor}};
	
	%------------
	% institute %
	%------------
	\ifdefined\insert@institute
	\node[tts@institute] (institute) at (\textwidth/2,-1.75) {\usebeamerfont{institute}\insert@institute};
	\else
	\fi
	
	%--------
	% email %
	%--------
	\ifdefined\insertemail
	% if instutite is defined, put email at the bottom
	\ifdefined\insert@institute
	\node[tts@email] (email) at (\textwidth/2,-4) {\usebeamerfont{email}\insertemail};
	% else put email at the position of “institute”
	\else
	\node[tts@email] (email) at (\textwidth/2,-1.75) {\usebeamerfont{email}\insertemail};
	\fi
	\else    
	\fi
	
	%-------
	% date %
	%-------
	\ifdefined\insert@date
	\node[tts@date] (date) at (\textwidth/2, -4.4) {\usebeamerfont{date}\insert@date};
	\fi
	\end{tikzpicture}
}




